<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>九九乘法表</title>
    <style>
        /* 用于设置奇数行样式 */
        tr:nth-child(odd) {
            background-color: #DDDDDD;
            font-weight: bold;
        }
    </style>
</head>

<body>
    <h2>九九乘法表</h2>
    <table id="multiplicationTable">
    </table>
    <script>
        window.onload = function () {
            const table = document.getElementById('multiplicationTable');
            for (let i = 1; i <= 9; i++) {
                const row = document.createElement('tr');
                for (let j = 1; j <= i; j++) {
                    const cell = document.createElement('td');
                    cell.textContent = `${j}*${i}=${i * j}`;
                    row.appendChild(cell);
                }
                table.appendChild(row);
            }
        };
    </script>
</body>

</html>
